<template>
	<view class="homeContainer" @click="goLogin()">
		<image src="https://t.acoer.cn/guoshiBgImg/homeBg1.png" class="homeBg1"></image>
		<view class="homeItem bg1">
			<view class="homeItem_title">共享空间</view>
			<view class="homeItem_info">{{shareTips}}</view>
		</view>
		<view class="homeItem bg2">
			<view class="homeItem_title">整间预约</view>
			<view class="homeItem_info">{{roomTips}}</view>
		</view>
		<view class="homeItem bg3">
			<view class="homeItem_title">位置预约</view>
			<view class="homeItem_info">{{stationTips}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shareTips:'需要学生共同预约教室，达到最低使用人数要求，开放教室使用',
				roomTips: '用户按需求预约整间教室，预约成功后可分享给其他人使用',
				stationTips: '用户按需求直接预约教室位置，预约成功后直接扫码进入教室使用'
			}
		},
		onLoad(options) {
			//alert("home"+window.location.hash);
			//共享空间预约文字说明 channelId=hnsd appCode=SYS004
			//整间预约文字说明 channelId=hnsd appCode=SYS005
			//位置预约文字说明 channelId=hnsd appCode=SYS006
			this.getInfo('SYS004');
			/* let _this = this;
			uni.getStorage({
			    key: 'token',
			    success: function (res) {
			        getApp().globalData.token = res.data;
					if(getApp().globalData.token && getApp().globalData.orderNum && getApp().globalData.orderNum != '') {
						setTimeout(()=> {
							uni.navigateTo({
							    url: '/pages/classroom/classroom?orderId='+getApp().globalData.orderNum
							});
						},1500)
					}
			    }
			}); */
		},
		onShow() {
			uni.getStorage({
			    key: 'token',
			    success: function (res) {
					if(res.data) {
						uni.switchTab({
						    url: '/pages/index/index'
						});
					}
			    }
			});
		},
		methods: {
			goLogin() {
					uni.navigateTo({
						url: '/pages/authorizeLogin',
					})		
			},
			getInfo(appCode) {
				let _this = this;
				this.$utils.requestFun('/auth/auth/api/channelConfigApi',{
					channelId: getApp().globalData.channelId,
					appCode: appCode
				},'GET').then(res=> {
					if(appCode == 'SYS004') {
						_this.shareTips = res.data.data.info;
						this.getInfo('SYS005');
					}else if(appCode == 'SYS005') {
						_this.roomTips = res.data.data.info;
						this.getInfo('SYS006');
					}else {
						_this.stationTips = res.data.data.info;
					}
				})
			}
		}
	}
</script>

<style>
	.homeContainer {
		width: 100%;
		height: 100vh;
		background: #FFFFFFF;
	}
	.txtOverFlow {
		overflow: hidden;
		text-overflow:ellipsis;
		white-space: nowrap;
	}
	.flex {
		display: flex;
	}
	.homeBg1 {
		width: 100%;
		height: 450rpx;
	}
	.homeItem {
		width: 100%;
		height: 312rpx;
		background-size: 100% 100%;
		background-repeat: no-repeat;
	}
	.bg1 {
		background-image: url("https://t.acoer.cn/guoshiBgImg/homeBg2.png");
	}
	.bg2 {
		background-image: url("https://t.acoer.cn/guoshiBgImg/homeBg3.png");
	}
	.bg3 {
		background-image: url("https://t.acoer.cn/guoshiBgImg/homeBg4.png");
	}
	.homeItem_title {
		font-size: 44rpx;
		font-weight: bold;
		color: #F8F8F8;
		margin-left: 74rpx;
		margin-bottom: 39rpx;
		padding-top: 60rpx;
	}
	.homeItem_info {
		font-size: 30rpx;
		color: #F8F8F8;
		margin-left: 74rpx;
		width: 82%;
	}
</style>
